package files;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by alone on 2018/10/27.
 *
 * @author lingfengsan
 */
public class Delete {
    public static void main(String[] args) {
        File file = new File("H:\\bt\\mt\\91porn-181025");
        deleteFiles(file);
    }

    private static void deleteFiles(File file) {
        if (file.isDirectory()) {
            if (file.listFiles() == null) return;
            for (File file1 : file.listFiles()) {
                deleteFiles(file1);
            }
        } else {
            String str = file.getAbsolutePath();
            if (str.endsWith(".mkv") || str.endsWith(".mp4") || str.endsWith(".wmv")) {
                if(!str.contains("_cut")){
                    file.delete();
                }
            }
        }
    }
}
